package com.easyOrder.web.action.material;

import com.easyOrder.core.comm.BaseAction;
import com.easyOrder.core.context.ApiMethodAttribute;
import com.easyOrder.dto.MaterialClassDTO;
import com.easyOrder.dto.TagDTO;
import com.easyOrder.service.material.MaterialService;
import com.google.common.base.Preconditions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;
import java.util.List;

/**
 * Created by liutao on 2017/7/17.
 */
@RestController
@RequestMapping("/material")
public class MaterialAction extends BaseAction{

    @Autowired
    private MaterialService materialService;

    @RequestMapping(value = "/by/{branchId}/find/{tag}", method = {RequestMethod.GET, RequestMethod.OPTIONS})
    @ApiMethodAttribute(nonSessionValidation = true)
    public Object findAllByBranchId(@PathVariable Long branchId,@PathVariable Long tag){
        Preconditions.checkArgument(null != branchId && null != tag, "当前二维码不可用");
        TagDTO tagDTO = materialService.findAllByBranchId(branchId, tag);
        return wrapperJsonView(tagDTO);
    }



}















